//
//  MBNoCommunityDataView.m
//  MobellCloud_ios
//
//  Created by cherry pu on 2018/1/2.
//  Copyright © 2018年 zhangXin. All rights reserved.
//

#import "MBNoCommunityDataView.h"

@interface MBNoCommunityDataView ()
@property (nonatomic,weak)UILabel* titleLabel;
@property (nonatomic,weak)UIImageView* iconImageView;

@end

@implementation MBNoCommunityDataView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UIImageView* iconImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"image_kong"]];
        self.iconImageView = iconImageView;
        [self addSubview:iconImageView];
        
        [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).with.offset([UIView lf_sizeFromIphone6:60]+frame.origin.y);
            make.centerX.equalTo(self);
        }];
        
        UILabel* titleLabel = [[UILabel alloc]init];
        self.titleLabel = titleLabel;
        titleLabel.text = @"您还没有发布任何帖子~";
        titleLabel.font = [UIFont lf_systemFontOfSize:15];
        titleLabel.textColor = [UIColor colorWithR:102 G:102 B:102];
        [self addSubview:titleLabel];
        
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(iconImageView.mas_bottom).with.offset([UIView lf_sizeFromIphone6:24]);
            make.centerX.equalTo(self);
        }];

    }
    return self;
}

-(void)setTitle:(NSString *)title
{
    _title = title;
    
    self.titleLabel.text = title;
}

-(void)setImageName:(NSString *)imageName
{
    _imageName = imageName;
    self.iconImageView.image = [UIImage imageNamed:imageName];
}

@end
